<!--#Include File="../conn.asp" -->
<!--#Include File="comm/inc.asp" -->
<%
'====================================================================
'= Team Elite - Elite Article System
'= Copyright (c) 2005 - 2006 Eason Chan All Rights Reserved.
'=-------------------------------------------------------------------
'= 版权协议：
'=	GPL (The GNU GENERAL PUBLIC LICENSE Version 2, June 1991)
'=-------------------------------------------------------------------
'= 文件名称：/Manager/Admin_Review.asp
'= 摘    要：后台-评论管理文件
'=-------------------------------------------------------------------
'= 最后更新：eason007
'= 最后日期：2005-12-21
'====================================================================

Call EA_Manager.Chk_IsMaster

If Not EA_Manager.Chk_Power(Admin_Power,"14") Then 
	ErrMsg=str_Comm_NotAccess
	Call EA_Manager.Error(1)
End If

Dim Atcion
Atcion=Request.QueryString ("atcion")

Select Case LCase(Atcion)
Case "del"
	Call Del
Case "pass"
	Call Pass
Case Else
	Call Main
End Select
Call EA_Pub.Close_Obj
Set EA_Pub=Nothing
	
Sub Main
	Dim Count,PageCount,Page,OutStr,i,PostId
	Dim FieldName(1),FieldValue(1)
	Dim WStr
	Dim TopicList
	Dim ListBlock,Temp
	
	Page=EA_Pub.SafeRequest(3,"page",0,1,0)
	PostId=EA_Pub.SafeRequest(3,"postid",0,0,0)
	WStr=EA_Pub.SafeRequest(3,"w",1,"",0)
	
	FieldName(0)="w"
	FieldName(1)="postid"
	
	FieldValue(0)=WStr
	FieldValue(1)=PostId
	
	Select Case WStr
	Case "1d"
		If iDataBaseType=0 Then 
			WStr=" Where DateDiff('d',a.AddDate,Now())=0"
		Else
			WStr=" Where DateDiff(d,a.AddDate,GetDate())=0"
		End If
	Case "1w"
		If iDataBaseType=0 Then 
			WStr=" Where DateDiff('ww',a.AddDate,Now())=0"
		Else
			WStr=" Where DateDiff(ww,a.AddDate,GetDate())=0"
		End If
	Case "1m"
		If iDataBaseType=0 Then 
			WStr=" Where DateDiff('m',a.AddDate,Now())=0"
		Else
			WStr=" Where DateDiff(m,a.AddDate,GetDate())=0"
		End If
	Case "pass"
		WStr=" Where a.IsPass="&EA_M_DBO.TrueValue
	Case "npass"
		WStr=" Where a.IsPass=0"
	Case "article_search"
		WStr=" Where a.ArticleId="&PostId
	Case Else
		WStr=""
	End Select

	PageContent=Template.LoadTemplate("admin_review_list.htm")


	Template.SetVariable "Language_Comm_ListEmpty",str_Comm_ListEmpty,PageContent
	Template.SetVariable "Language_Comm_Today",str_Comm_Today,PageContent
	Template.SetVariable "Language_Comm_Week",str_Comm_Week,PageContent
	Template.SetVariable "Language_Comm_Month",str_Comm_Month,PageContent
	Template.SetVariable "Language_Comm_State_NoPass",str_Comm_State_NoPass,PageContent
	Template.SetVariable "Language_Comm_State_Pass",str_Comm_State_Pass,PageContent
	Template.SetVariable "Language_Comm_Alert_Del_Operation",str_Comm_Alert_Del_Operation,PageContent
	Template.SetVariable "Language_Comm_Del_Operation",str_Comm_Del_Operation,PageContent
	Template.SetVariable "Language_Comm_Alert_Pass_Operation",str_Comm_Alert_Pass_Operation,PageContent

	Template.SetVariable "Language_OperationNotice",str_OperationNotice,PageContent
	Template.SetVariable "Language_Help_Help",str_Placard_Help,PageContent

	Template.SetVariable "Language_Review_User",str_Review_User,PageContent
	Template.SetVariable "Language_Review_UnderArticle",str_Review_UnderArticle,PageContent


	ListBlock=Template.GetBlock("list",PageContent)

	SQL="Select Count([Id]) From [NB_Review] a"&WStr
	Count=Conn.Execute(SQL)(0)
	If Count>0 Then 
		Template.SetVariable "ListTempty","none",PageContent

		If Rs.State=1 Then Rs.Close
		'0=Id,1=Ip,2=Content,3=UserName,4=AddDate,5=IsPass,6=Article_Title,7=Article_Id,8=Article_AddDate
		If iDataBaseType=0 Then 
			SQL="Select a.[Id],a.Ip,a.Content,IIF(a.UserId=0,a.UserName,'[会员]'+a.UserName),a.AddDate,a.IsPass,IIF(b.Title Is Null,'<font color=800000>文章已被删除</font>',b.Title),a.ArticleId,IIF(b.AddDate Is Null,Now(),b.AddDate) From [NB_Review] a Left Join [NB_Content] b On a.ArticleId=b.[Id]"&WStr&" Order By a.[Id] Desc"
		Else
			SQL="Select a.[Id],a.Ip,a.Content,Case a.UserId When 0 Then a.UserName Else '[会员]'+a.UserName End,a.AddDate,a.IsPass,IsNull(b.Title,'<font color=800000>文章已被删除</font>'),a.ArticleId,IsNull(b.AddDate,GetDate()) From [NB_Review] a Left Join [NB_Content] b On a.ArticleId=b.[Id]"&WStr&" Order By a.[Id] Desc"
		End If
		Rs.Open SQL,Conn,1,1
		If Not rs.eof And Not rs.bof Then 
			Rs.AbsolutePosition=Rs.AbsolutePosition+((Abs(Page)-1)*10)
			TopicList=Rs.GetRows(10)
		End If
		Rs.Close:Set rs=Nothing
	
	    For i=0 To Ubound(TopicList,2)
			Temp=ListBlock

			Template.SetVariable "UserName",EA_Pub.Full_HTMLFilter(TopicList(3,i)),Temp
			Template.SetVariable "PostIP",TopicList(1,i),Temp
			Template.SetVariable "PostTime",TopicList(4,i),Temp
			Template.SetVariable "ArticleUrl",EA_Pub.Cov_ArticlePath(TopicList(7,i),TopicList(8,i),TopicList(8,i),EA_Pub.SysInfo(18)),Temp
			Template.SetVariable "ArticleTitle",TopicList(6,i),Temp
			Template.SetVariable "Content",EA_Pub.Full_HTMLFilter(TopicList(2,i)),Temp
			Template.SetVariable "ReviewID",TopicList(0,i),Temp
			Template.SetVariable "ArticleID",TopicList(7,i),Temp
			If TopicList(5,i) Then Template.SetVariable "NoPass","none",Temp

			Template.SetBlock "list",Temp,PageContent
		Next

		Template.SetVariable "PageListNav",EA_Manager.PageList(10,Count,Page,FieldName,FieldValue),PageContent
	End If
	Template.CloseBlock "list",PageContent


	Template.BaseReplace PageContent
	Template.OutStr PageContent
End Sub

Sub Del
	Call EA_Pub.Chk_Post
	
	Dim PostId
	PostId=EA_Pub.SafeRequest(3,"postid",0,0,3)
	
	EA_M_DBO.Set_Review_Delete PostId
	
	Call EA_Pub.Close_Obj
	Set EA_Pub=Nothing

	Application.Lock 
	Application(sCacheName&"IsFlush")=1
	Application.UnLock 
	
	Response.Redirect Request.ServerVariables("HTTP_REFERER")
End Sub

Sub Pass
	Call EA_Pub.Chk_Post
	
	Dim PostId,ArticleId
	PostId=EA_Pub.SafeRequest(3,"postid",0,0,3)
	ArticleId=EA_Pub.SafeRequest(3,"articleid",0,0,3)
	
	If PostId<>0 Then 
		EA_M_DBO.Set_Review_Pass 1,PostId
		EA_DBO.Set_Article_ReviewStat 1,ArticleId

		Application.Lock 
		Application(sCacheName&"IsFlush")=1
		Application.UnLock 
	End If
	
	Call EA_Pub.Close_Obj
	Set EA_Pub=Nothing
	
	Response.Redirect Request.ServerVariables("HTTP_REFERER")
End Sub
%>